/**
 * Created by njb on 2017/10/11.
 */
const webpack = require('webpack');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const common = require('./webpack.common.js');

module.exports = merge(common, {
    // devtool: 'source-map',
    devtool: 'cheap-module-source-map',
    plugins: [
        // new UglifyJSPlugin(),
        // new UglifyJSPlugin({
        //     sourceMap: true
        // }),
        new UglifyJSPlugin(),

        new webpack.DefinePlugin({
            'process.env': { //指定环境
                'NODE_ENV': JSON.stringify('production')
            }
        }),

        new webpack.HashedModuleIdsPlugin(),

        // 指定公共 bundle 的名称。
        new webpack.optimize.CommonsChunkPlugin({
            name: 'vendor'
        }),

        new webpack.optimize.CommonsChunkPlugin({
            name: 'common'
        })
    ]
});